layui.config({
    version:'1510164124181'
}).use(['form', 'laypage', 'layer', 'element'],function(){
    form = layui.form;
    layer = layui.layer;
    $ = layui.jquery;
    laypage = layui.laypage;//分页
    element = layui.element; //元素操作

    SelectCollectList();
});

function ExprotInfo() {
    let TempState = $("#types").val();
    let inputname = $("#inputname").val();
    window.location.href=httpurl + "/ExprotCartCollectList?type="+TempState+"&inputname="+inputname;
}


//查询收藏  购物车 商品信息
function SelectCollectList(){
    let TempState = $("#types").val();
    let inputname = $("#inputname").val();
    $("#tableInfo tbody").html("");
    var index = top.layer.msg('加载中，请稍候',{icon: 16,time:false,shade:0.8});
    $.ajax({
        url: httpurl + "/selectCollectList",
        cache: false,
        headers: {
            "Access-Control-Allow-Origin": "*",
            "Access-Control-Allow-Methods": "*",
            "Access-Control-Allow-Headers": "Authorization",
            "Authorization": GetTokenInfo()
        },
        contentType : 'application/json',
        data: {
            "page":pageNo,
            "pagesize":pageRecords,
            "type":TempState,
            "inputname":inputname,
        },
        success: function (data) {
            let dataHtml="";
            if(data.rtnCode==200){
                let dataInfo=data.data;
                totalRecords =dataInfo[dataInfo.length-1].total;
                for(let i=0;i<dataInfo.length;i++){
                    let shopCartEntityList = dataInfo[i].shopCartEntityList;
                    dataHtml+='<tr class="text-primary">'+
                                '<td class="width20"><img width="70%" src="'+visitimgurl+'/'+dataInfo[i].productEntity.headimg+'"></>'+
                                '<td>'+dataInfo[i].productEntity.title+'</td>'+
                                '<td colspan="2"><table class="width100"><tbody>';
                                 for(let a=0;a<shopCartEntityList.length;a++){
                                    dataHtml+='<tr><td class="width50">'+shopCartEntityList[a].openid+'</td><td class="50%">'+shopCartEntityList[a].num+'</td></tr>';
                                 }
                            dataHtml+='</tbody></table></td></tr>';
                }
            }else{
                totalRecords=0;
                dataHtml += '<tr>'
                    +'<td colspan="12" style="text-align:center;">暂无数据</td>'
                    +'</tr>';
            }
            $("#tableInfo tbody").html(dataHtml);
            top.layer.closeAll();
            pageLayPage("SelectCollectList");
        }
    });
}

function SearchInfo() {
    pageNo=1;
    SelectCollectList();
}
